package com.hubu.jwxt.controller;

import com.hubu.jwxt.beans.Course;
import com.hubu.jwxt.service.CourseService;
import com.hubu.jwxt.utils.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class CourseController {

    @Autowired
    private CourseService courseService;

    @RequestMapping("/course/list")
    public String list(@RequestParam(value = "pageNum",defaultValue = "1")int pageNum, @RequestParam(value = "Tid") int Tid ,Model model){
        PageHelper<Course> pageHelper = courseService.queryCourses(pageNum, 5,Tid);
        model.addAttribute("pageHelper",pageHelper);
        return "/course-list.html";

    }
}
